package com.fmsz.physicalheadline.entity.top;

import android.content.Context;
import android.content.Intent;
import android.databinding.DataBindingUtil;
import android.databinding.ViewDataBinding;
import android.graphics.drawable.ColorDrawable;
import android.media.MediaPlayer;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.SurfaceView;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.PopupWindow;
import android.widget.Toast;

import com.fmsz.physicalheadline.R;
import com.fmsz.physicalheadline.activitys.BaseActivity;
import com.fmsz.physicalheadline.activitys.head.DetailActivity;
import com.fmsz.physicalheadline.databinding.DynamicIvLargeItemBinding;
import com.fmsz.physicalheadline.databinding.HeadPopupBinding;
import com.fmsz.physicalheadline.util.CustomPopupWindow;
import com.google.gson.annotations.Expose;

import java.io.IOException;
import java.util.Date;
import java.util.List;

/**
 * Created by Administrator on 2016/12/28.
 */

public class Snapshots implements MediaPlayer.OnPreparedListener, MediaPlayer.OnCompletionListener, View.OnClickListener {
    private long id;
    private int source_type,content_type,video_type,category_index;
    private String source_data,text,image,video_link,editor,update_time;
    private List<String> images;
    private Date create_time;
    private SourceDataObj source_data_obj;

    public int getCategory_index() {
        return category_index;
    }

    public void setCategory_index(int category_index) {
        this.category_index = category_index;
    }

    public int getContent_type() {
        return content_type;
    }

    public void setContent_type(int content_type) {
        this.content_type = content_type;
    }

    public Date getCreate_time() {
        return create_time;
    }

    public void setCreate_time(Date create_time) {
        this.create_time = create_time;
    }

    public String getEditor() {
        return editor;
    }

    public void setEditor(String editor) {
        this.editor = editor;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public List<String> getImages() {
        return images;
    }

    public void setImages(List<String> images) {
        this.images = images;
    }

    public String getSource_data() {
        return source_data;
    }

    public void setSource_data(String source_data) {
        this.source_data = source_data;
    }

    public SourceDataObj getSource_data_obj() {
        return source_data_obj;
    }

    public void setSource_data_obj(SourceDataObj source_data_obj) {
        this.source_data_obj = source_data_obj;
    }

    public int getSource_type() {
        return source_type;
    }

    public void setSource_type(int source_type) {
        this.source_type = source_type;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public String getUpdate_time() {
        return update_time;
    }

    public void setUpdate_time(String update_time) {
        this.update_time = update_time;
    }

    public String getVideo_link() {
        return video_link;
    }

    public void setVideo_link(String video_link) {
        this.video_link = video_link;
    }

    public int getVideo_type() {
        return video_type;
    }

    public void setVideo_type(int video_type) {
        this.video_type = video_type;
    }

    @Override
    public void onClick(View v) {
//        Toast.makeText(v.getContext(), "success", Toast.LENGTH_SHORT).show();
    }

    public class SourceDataObj{
        private String avatar,url,nick_name;
        private int url_type;
        private boolean click_flag;

        public String getAvatar() {
            return avatar;
        }

        public void setAvatar(String avatar) {
            this.avatar = avatar;
        }

        public boolean isClick_flag() {
            return click_flag;
        }

        public void setClick_flag(boolean click_flag) {
            this.click_flag = click_flag;
        }

        public String getNick_name() {
            return nick_name;
        }

        public void setNick_name(String nick_name) {
            this.nick_name = nick_name;
        }

        public String getUrl() {
            return url;
        }

        public void setUrl(String url) {
            this.url = url;
        }

        public int getUrl_type() {
            return url_type;
        }

        public void setUrl_type(int url_type) {
            this.url_type = url_type;
        }
    }

    public void clickDetails(View view){
        Context context = view.getContext();
        Intent intent = new Intent(context, DetailActivity.class);
        intent.putExtra("webUrl",source_data_obj.url);
        context.startActivity(intent);
    }
    public void clickShare(final View view){
       new CustomPopupWindow(view);
    }
    @Override
    public void onPrepared(MediaPlayer mp) {
        mp.start();

    }
    @Override
    public void onCompletion(MediaPlayer mp) {


    }
}
